<!-- #include file="sql_student.asp" -->

来源:百度知道 编辑:UC知道 时间:2024/05/30 01:16:15
<!-- #include file="sql_student.asp" -->
<%
Dim qx,u_name,pw
qx=request.form("identity")
u_name=request.form("u_name")
pw=request.form("pw")
if u_name="" or pw="" then
response.write("<script language=javascript> alert('用户名和密码不能为空');location.href='login.html' </script>")
end if
%>
<%
if qx="管理员" then
set rs=server.Createobject("adodb.recordset")
sql="select * from admin where t_name='" & u_name & "' and t_pw='" & pw & "'"
rs.open sql,conn,1,3
if rs.eof or rs.bof then
response.write("<script language=javascript> alert('用户名或密码有错误');location.href='login.html' </script>")
response.end
else
session("pw")="true"
session("u_name")=u

<!-- #include file="sql_student.asp" -->
<%
Dim qx,u_name,pw
qx=request.form("identity") '获得返回值
u_name=request.form("u_name") '获得返回值
pw=request.form("pw") '获得返回值
if u_name="" or pw="" then '如果为空值
response.write("<script language=javascript> alert('用户名和密码不能为空');location.href='login.html' </script>") '弹出提示
end if
%>
<%
if qx="管理员" then '如果是管理员
set rs=server.Createobject("adodb.recordset")
sql="select * from admin where t_name='" & u_name & "' and t_pw='" & pw & "'" '查询数据库 比较用户名密码
rs.open sql,conn,1,3
if rs.eof or rs.bof then '如果没有数据
response.write("<script language=javascript> alert('用户名或密码有错误');location.href='login.html' </script>") '弹出提示 说明用户密